
<?php
	$path="C:/xampp/htdocs/00_JO/JOi/";
 	include ($path.'controller/JO_kpopnewsController.php');
?>

<script>
    nmenuindex=3;
</script>

        <div style="width: 960px;background: url(JO_images/hr.gif1) repeat-x top left #222;position: relative;float:left;

             ">
              <? include 'JO_007_nav1.php';?>

            <div class="mar8i"></div>
            <div style="margin-left: 0px;background: url(JO_images/333.png) repeat-y 487px 0px #1a1a1a;" class="bar_720i">
                <div class="bar_480i" style="margin-left: 0px;top:0px">
                    <div class="JO_h1i">K-Pop News</div>
                    <div class="mar8i"></div>
                    <div style="float: left;margin-bottom: 8px; width: 472px;">
                   <?php
			 	$reult_count=JO_kpopnews_getlist(1);
				$total=$reult_count->num_rows;
				$page=1;
				$limit=10;
				$i=1;
				if(($total%$limit)!=0) {$numpages=(int)($total/$limit)+1;}
				else                {$numpages=$total/$limit;}
				if(isset ($_REQUEST["Page"])){$page=$_REQUEST["Page"];}
				$vt=(($page-1)*$limit)+1;
				$results=JO_kpopnews_getpagelist($vt,$limit,1);
				if($results!=NULL)
				while($rows=$results->fetch_array()){
			 		if($rows['image']!="")
					{
				?>
                
                        <div class="JO_kpopnews_itemi">
                            <div class="JO_newimg">
                                <img src="<?=JO_UNconvertHTMLentities($rows['image'])?>"/>
                            </div>
                            <div class="mar8i"></div>
                            <div class="JO_newscontenti">
                                <a href="?JO_unit=008_KPopNews_Detail&SO_chude=<?=$rows['key']?>&type=1&SO_relate=<?=JO_UNconvertHTMLentities($rows['tag'])?>&type=1"><b><?=JO_UNconvertHTMLentities($rows['title'])?></b><br/></a>
                                <i class="JO_ii"><?=$rows['insert']?></i><br/>
                               <?=html_entity_decode($rows['description'], ENT_QUOTES,'utf-8')?>
                                <div class="JO_kpop_relatedi">
                                    <div class="mar8i"></div>
                                    <ul class="nav_relatedi" style="padding-bottom: 0px;">
                                    <?php 
									$result_news_relate=JO_news_relate_getlist(1,$rows['tag'],$rows['key']);
									if($result_news_relate->num_rows)
									while($row_news_relate=$result_news_relate->fetch_array()){						
									 ?>
                                        <li><a href="?JO_unit=008_KPopNews_Detail&SO_chude=<?=JO_UNconvertHTMLentities($row_news_relate['key'])?>&SO_relate=<?=JO_UNconvertHTMLentities($rows['tag'])?>&type=1"><?=JO_UNconvertHTMLentities($row_news_relate['title'])?></a></li>
                                      <?php }?> 
                                      </ul>
                                </div>
                            </div>

                        </div>
                       <?php 
					}
					   else
					   {  ?>
                        <div class="JO_kpopnews_itemi">
                            <div class="JO_newscontent2i">
                                <a href="?JO_unit=008_KPopNews_Detail&SO_chude=<?=$rows['key']?>&type=1&SO_relate=<?=JO_UNconvertHTMLentities($rows['tag'])?>&type=1"><b><?=JO_UNconvertHTMLentities($rows['title'])?></b><br/></a>
                                <i class="JO_ii"><?=$rows['insert']?></i><br/>
                               <?=html_entity_decode($rows['description'], ENT_QUOTES,'utf-8')?>

                                <div class="JO_kpop_relatedi">
                                    <div class="mar8i"></div>
                                    <ul class="nav_relatedi" style="padding-bottom: 0px;">
                                       <?php 
									$result_news_relate=JO_news_relate_getlist(1,$rows['tag'],$rows['key']);
									if($result_news_relate!=NULL)
									while($row_news_relate=$result_news_relate->fetch_array()){						
									 ?>
                                        <li><a href="?JO_unit=008_KPopNews_Detail&SO_chude=<?=JO_UNconvertHTMLentities($row_news_relate['key'])?>&SO_relate=<?=JO_UNconvertHTMLentities($rows['tag'])?>&type=1"><?=JO_UNconvertHTMLentities($row_news_relate['title'])?></a></li>
                                      <?php }?> 
                                    </ul>
                                </div>
                            </div>

                        </div>
                        <?php } }?>
                        
                        
                    </div>
                    <div class="JO_h1i">Other News</div>
                    <div class="mar8i"></div>
                    <div style="float: left;margin-bottom: 8px; width: 472px;">
                        <ul class="nav_relatedi" style="padding-bottom: 0px;padding: 0px 8px 0px 0px;">
                        <?php
                        $results=JO_kpopnews_getpagelist(11,10,1);
						if($results!=NULL)
						while($rows_relate=$results->fetch_array()){ ?>
                            <li><a href="?JO_unit=008_KPopNews_Detail&SO_chude=<?=$row_news_relate['key']?>&SO_relate=<?=JO_UNconvertHTMLentities($rows_relate['tag'])?>&type=1"><i class="JO_ii"><?=$rows_relate['insert']?></i><?=JO_UNconvertHTMLentities($rows_relate['title'])?></a></li>
                           
                         <?php } ?>
                         	<li class="JO_lasti" style="line-height:24px;text-align:center">
                            
                            							<?

               		 if($numpages>1){
                    if($page>2){
                    ?>
              <a href="#" onclick="sendurl('1');">◀</a>
              <?
                    }
                    if($page>1){
                    ?>
              <a href="#" onclick="sendurl('<?=($page-1)?>');">◁</a>
              <?
                    }
                    if($page-4>1) echo "...";
                    for($i=$page-4;$i<=($page-1);$i++){
                        if($i>0){
                        ?>
              <a href="#" onclick="sendurl('<?=$i?>');">
              <?=$i?>
              </a>
              <?
                        }
                    }
                    echo  "<b style='color=#ffffff;'><u>".$page."</u></b>";
                    for($i=$page+1;$i<=($page+4);$i++){
                        if($i<=$numpages){
                        ?>
              <a href="#" onclick="sendurl('<?=$i?>');">
              <?=$i?>
              </a>
              <?
                        }
                    }
                    if($page+4<$numpages) echo "...";
                    if($page<$numpages){
                    ?>
              <a href="#" onclick="sendurl('<?=($page+1) ?>');">▷</a>
              <?
                    }
                    if($page<($numpages-1)){
                    ?>
              <a href="#" onclick="sendurl('<?=$numpages ?>');">▶</a>
              <?
                    }

                }
                 ?>

                            </li>
                        </ul>
                    </div>
                </div>
                <div class="mar8i"></div>
                <? include 'JO_008_nav4.php';?>
            </div>
	
            
        </div>

